furny.ga.logger
Class StatisticsDBManager

java.lang.Object
  extended by furny.ga.logger.StatisticsDBManager

public final class StatisticsDBManager
extends java.lang.Object

Database manager for statistics.

Since:
11.08.2012
Author:
Stephan Dreyer

Field Summary
private  javax.persistence.EntityManagerFactory entityManagerFactory
           
private static StatisticsDBManager INSTANCE
           
private static java.util.logging.Logger LOGGER
           
private static java.lang.String PARAMETERS
           
 
Constructor Summary
private StatisticsDBManager()
          Private constructor for single instance.
 
Method Summary
private  javax.persistence.EntityManager createEntityManager()
          Creates an EntityManager to start a database transaction.
 void exit()
          Lets the manager exit and clean up its resources.
 java.util.List<IndividualEntry> getIndividuals(java.lang.Long runId, EventType... types)
          Get individuals by their types.
static StatisticsDBManager getInstance()
          Getter for the single instance.
 java.util.List<java.lang.Long> getRunEntries()
          Get all run entries.
static void main(java.lang.String[] args)
          Main method for testing.
 void saveEvaluationRun(EvaluationRunEntry run, boolean merge)
          Saves a run.
 void saveGeneEntry(GeneEntry gene)
          Save a gene entry.
 void saveIndividualEntry(IndividualEntry individual)
          Save a individual entry.
 void saveLogEvent(LogEvent event)
          Save a new log event.
 void setCustomFilename(java.lang.String filename)
          Sets a custom file name for the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final java.util.logging.Logger LOGGER

INSTANCE

private static final StatisticsDBManager INSTANCE

PARAMETERS

private static final java.lang.String PARAMETERS
See Also:
Constant Field Values

entityManagerFactory

private javax.persistence.EntityManagerFactory entityManagerFactory
Constructor Detail

StatisticsDBManager

private StatisticsDBManager()
Private constructor for single instance.

Since:
10.08.2012
Method Detail

getInstance

public static StatisticsDBManager getInstance()
Getter for the single instance.

Returns:
Single instance of this manager.
Since:
10.08.2012

createEntityManager

private javax.persistence.EntityManager createEntityManager()
Creates an EntityManager to start a database transaction.

Returns:
A new entitity manager.
Since:
10.08.2012

setCustomFilename

public void setCustomFilename(java.lang.String filename)
Sets a custom file name for the database.

Parameters:
filename - Statistics database file name.
Since:
10.08.2012

saveEvaluationRun

public void saveEvaluationRun(EvaluationRunEntry run,
                              boolean merge)
Saves a run.

Parameters:
run - The evaluation run.
merge - Merge (true) or create.
Since:
11.08.2012

saveLogEvent

public void saveLogEvent(LogEvent event)
Save a new log event.

Parameters:
event - The event.
Since:
11.08.2012

saveGeneEntry

public void saveGeneEntry(GeneEntry gene)
Save a gene entry.

Parameters:
gene - The gene entry.
Since:
11.08.2012

saveIndividualEntry

public void saveIndividualEntry(IndividualEntry individual)
Save a individual entry.

Parameters:
individual - The entry.
Since:
11.08.2012

getRunEntries

public java.util.List<java.lang.Long> getRunEntries()
Get all run entries.

Returns:
Entries of evaluation runs.
Since:
11.08.2012

getIndividuals

public java.util.List<IndividualEntry> getIndividuals(java.lang.Long runId,
                                                      EventType... types)
Get individuals by their types.

Parameters:
runId - Id of the evaluation run.
types - Types of individuals.
Returns:
List of individual entries.
Since:
11.08.2012

exit

public void exit()
Lets the manager exit and clean up its resources. It will not be reusable after that!

Since:
10.08.2012

main

public static void main(java.lang.String[] args)
Main method for testing.

Parameters:
args - arguments
Since:
11.08.2012